****************************************************************************************************
****************************************************************************************************
*Replication file for:
*The Importance of a Liberal Power's Attention to Democratic Elections Around the World
*Johannes Bubeck Ashrakat Elshehawy Nikolay Marinov Federico Nanni
****************************************************************************************************
****************************************************************************************************


clear

*please use your own working directory
cd "/Data/"

*use data prepared in step 1 
use neldaprep

****************************
*merge with VDem data
rename ccode COWcode
replace COWcode=255 if COWcode==260
merge m:1 COWcode year using  "V-Dem-DS-CY+Others-v6.dta", keepusing(v2x_polyarchy)  
replace COWcode=260 if COWcode==255 
drop if _m==2
rename v2x_polyarchy t_vdems
rename COWcode ccode 
order t_vdem
drop _m

*generate categorical ranking measure
generate tvdemcat=recode(t_vdem,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1)

label var tvdemcat "V-Dem Categorical Ranking"

table tvdemcat

*save datasets
save vdempolyarchy,replace

* please the run this R code (10_FigureD.9.R) for replication of the figure D.9




